<blockquote class="layui-elem-quote">
    <div class="layui-inline">
        <i class="layui-icon layui-icon-list layui-head-icon"></i>
        <span class="layui-font-16 layui-font-green">任务管理</span>
    </div>
    <div class="layui-pull-right">
        <a class="layui-btn layui-btn-primary layui-border-green" href="{:url('/store/market/task/create')}">添加任务</a>
    </div>
</blockquote>
<div class="layui-card">
    <div class="layui-card-body">
        <fieldset class="layui-elem-field">
            <legend>条件搜索</legend>
            <div class="layui-field-box">
                <form class="layui-form layui-form-pane" action="{:url('/store/market//task')}" method="GET">
                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label class="layui-form-label">添加时间</label>
                            <div class="layui-inline" id="time">
                                <div class="layui-input-inline">
                                    <input type="text" autocomplete="off" name="start_time" id="strat-time" class="layui-input" placeholder="开始日期">
                                </div>
                                <div class="layui-form-mid">-</div>
                                <div class="layui-input-inline">
                                    <input type="text" autocomplete="off" name="end_time" id="end-time" class="layui-input" placeholder="结束日期">
                                </div>
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label">任务类型</label>
                            <div class="layui-input-inline">
                                <select name="task_type" class="layui-select">
                                    <option value=""></option>
                                    <option value="1">邀请好友</option>
                                    <option value="2">参与购买会员套餐</option>
                                    <option value="3">参与拼团活动</option>
                                    <option value="4">参与发布转卖商品</option>
                                    <option value="5">参与购买转卖商品</option>
                                </select>
                            </div>
                        </div>
                        <div class="layui-inline">
                            <div class="layui-input-inline">
                                <button  class="layui-btn" lay-submit lay-filter="search">搜索</button>
                            </div>
                        </div>
                    </div>
                </form>
            </div>
        </fieldset>
        <form class="layui-form">
            <table class="layui-table">
                <thead>
                <tr>
                    <th>ID</th>
                    <th>任务类型</th>
                    <th>有效时间</th>
                    <th>状态</th>
                    <th>创建时间</th>
                    <th>更新时间</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>

                {foreach $list as $vo}
                <tr>
                    <td>{$vo.id}</td>
                    <td>
                        {switch $vo.task_type}
                            {case 1} 邀请{$vo.join_num}名好友获得{$vo.give_integral}个积分 {/case}
                            {case 2} 参与购买{empty name='vo.combo_name'}会员{else /}{$vo.combo_name}{/empty}套餐获得{$vo.give_integral}个积分 {/case}
                            {case 3} 参与{empty name='vo.activity_title'}参与拼团{else /}{$vo.activity_title}{/empty}活动获得{$vo.give_integral}个积分 {/case}
                            {case 4} 参与发布{$vo.join_num}次转卖商品获得{$vo.give_integral}个积分 {/case}
                            {case 5} 参与购买{$vo.join_num}次转卖商品获得{$vo.give_integral}个积分 {/case}
                        {/switch}
                    </td>
                    <td>
                        {if $vo.expire_type==1}
                            领取后{$vo.expire_time}小时有效
                        {/if}
                        {if $vo.expire_type==2}
                            {$vo.start_time|date='Y-m-d H:i:s'}~{$vo.end_time|date='Y-m-d H:i:s'}
                        {/if}
                    </td>
                    <td>
                        {switch $vo.status}
                            {case 0} <span class="layui-font-red">关闭</span> {/case}
                            {case 1} <span class="layui-font-green">开启</span> {/case}
                            {case -1} <span class="layui-font-yellow">已失效</span> {/case}
                        {/switch}
                    </td>
                    <td>{$vo.create_time|date='Y-m-d H:i:s'}</td>
                    <td>{$vo.update_time|date='Y-m-d H:i:s'}</td>
                    <td>
                        <a class="layui-btn layui-btn-sm" href="{:url('/store/market/task/edit',['id'=> $vo.id])}">编辑</a>
                        <a class="layui-btn layui-btn-sm layui-btn-danger del" data-url="{:url('/store/market/task/delete',['id'=> $vo.id])}">删除</a>
                    </td>
                </tr>
                {/foreach}
                </tbody>
            </table>
        </form>
        {$list|raw}
    </div>
</div>
<script>
    layui.use('laydate',function (){
        var laydate = layui.laydate;
        laydate.render({
            elem: '#time',
            type: 'datetime',
            range: ['#strat-time', '#end-time'],
        });
    })
</script>